package it.xiuxian.personcenter.presenter

import com.lzy.okgo.OkGo
import it.xiuxian.lib.base.BaseBean
import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.personcenter.activity.GongGaoActivity
import it.xiuxian.personcenter.bean.GongGaoList
import org.json.JSONObject

class GongGaoActivityPresenter:BasePresenter<GongGaoActivity>(){
    fun getList(pageNo:String){
        var json1 = JSONObject()
        json1.put("pageNo",pageNo)
        OkGo.post<BaseBean<GongGaoList>>(HttpConfig.BASE_URL+"/appnotice/list")
                .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
                .execute(object : CallBackOption<BaseBean<GongGaoList>>() {}.loadBind(mView as GongGaoActivity).execute(
                        object : ILoadBind<BaseBean<GongGaoList>> {
                            override fun excute(bean: BaseBean<GongGaoList>) {
                                if(bean.code==0){
                                    (mView as GongGaoActivity).geData(bean.data)
                                }
                            }
                        }
                ))
    }
}